package cn.itsource;

import cn.itsource.common.NoScan;
import cn.itsource.config.RibbonConfig;
import cn.itsource.domain.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.client.RestTemplate;

/**
 * @description: 订单服务的启动类
 */
@SpringBootApplication
//@EnableEurekaClient：标记该应用是 Eureka客户端
@EnableEurekaClient
@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION,value = NoScan.class))
@RibbonClient(value = "user-server",configuration = RibbonConfig.class)
public class OrderServerApplication1030 {

    //配置一个RestTemplate ，Spring封装的一个基于Restful风格的http客户端工具
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    public static void main(String[] args) {

        SpringApplication.run(OrderServerApplication1030.class);
    }
}